﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.datatype;
using umbraco.editorControls;
using umbraco.interfaces;

namespace CodeGecko.Umbraco.DataTypes
{
    public class DoctypePickerDataType : umbraco.cms.businesslogic.datatype.BaseDataType, IDataType
    {
        private IDataEditor _Editor;
        private IData _baseData;
        private IDataPrevalue _prevalueeditor;

        public override IDataEditor DataEditor {
            get {
                if (_Editor == null) _Editor = new DoctypePicker(Data);
                return _Editor;
            }
        }

        public override IData Data {
            get {
                if (_baseData == null) _baseData = new umbraco.cms.businesslogic.datatype.DefaultData(this);
                return _baseData;
            }
        }

        public override Guid Id { get { return new Guid("944A6A73-B10E-4D1C-ACF6-575D3BC1A85B"); } }

        public override string DataTypeName { get { return "Document Type Picker"; } }

        public override IDataPrevalue PrevalueEditor {
            get {
                if (_prevalueeditor == null) _prevalueeditor = new DefaultPrevalueEditor(this, false);
                return _prevalueeditor;
            }
        }
    }
}